'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    /**
     * Add altering commands here.
     *
     * Example:
     * await queryInterface.createTable('users', { id: Sequelize.INTEGER });
     */
    const { INTEGER, STRING, DATE } = Sequelize;
    await queryInterface.createTable("sys_config", {
      config_id: {
        type: INTEGER(20),
        comment: "参数主键",
        allowNull: false,
        primaryKey: true,
        autoIncrement: true
      },
      config_name: {
        type: STRING(100),
        comment: "参数名称",
        defaultValue: ""
      },
      config_key: {
        type: STRING(100),
        comment: "参数键名",
        defaultValue: ""
      },
      config_value: {
        type: STRING(500),
        comment: "参数键值",
        defaultValue: ""
      },
      config_type: {
        type: STRING(1),
        comment: "系统内置（Y是 N否）",
        defaultValue: "N"
      },
      create_by: {
        type: STRING(64),
        comment: "创建者",
        defaultValue: ""
      },
      update_by: {
        type: STRING(64),
        comment: "更新者",
        defaultValue: ""
      },
      remark: {
        type: STRING(500),
        comment: "备注",
        defaultValue: ""
      },
      created_at: {
        type: DATE,
        comment: "创建时间",
      },
      updated_at: {
        type: DATE,
        comment: "更新时间",
      },
      deleted_at: {
        type: DATE,
        comment: "删除时间",
      }
    })
  },

  down: async (queryInterface, Sequelize) => {
    /**
     * Add reverting commands here.
     *
     * Example:
     * await queryInterface.dropTable('users');
     */
  }
};
